# eric7.WebBrowser.CookieJar.CookieJar

Module implementing a QNetworkCookieJar subclass with various accept policies.

### Global Attributes

None

### Classes

CookieAcceptPolicy | Class defining the cookie accept policies.
CookieExceptionRuleType | Class defining the cookie exception rule types.
CookieJar | Class implementing a QNetworkCookieJar subclass with various accept policies.
CookieKeepPolicy | Class defining the cookie keep policies.

### Functions

None

## CookieAcceptPolicy

Class defining the cookie accept policies.

### Derived from

enum.Enum

### Class Attributes

Always
Never
OnlyFromSitesNavigatedTo

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## CookieExceptionRuleType

Class defining the cookie exception rule types.

### Derived from

enum.Enum

### Class Attributes

Allow
AllowForSession
Block

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## CookieJar

Class implementing a QNetworkCookieJar subclass with various accept policies.

### Signals

cookiesChanged()
  emitted after the cookies have been changed

### Derived from

QNetworkCookieJar

### Class Attributes

None

### Class Methods

None

### Methods

CookieJar | Constructor
__cookieAdded | Private slot handling the addition of a cookie.
__cookieFilter | Private method to filter cookies.
__cookieRemoved | Private slot handling the removal of a cookie.
__isOnDomainList | Private method to check, if either the rule matches the domain exactly or the domain ends with ".rule".
__load | Private method to load the cookies settings.
__matchDomain | Private method to check, if a URLs host matches a cookie domain according to RFC 6265.
__rejectCookie | Private method to test, if a cookie shall be rejected.
__save | Private method to save the cookies settings.
acceptPolicy | Public method to get the accept policy.
allowForSessionCookies | Public method to return the list of allowed session cookie domains.
allowedCookies | Public method to return the list of allowed domains.
blockedCookies | Public method to return the list of blocked domains.
clear | Public method to clear all cookies.
close | Public slot to close the cookie jar.
cookieDomains | Public method to get a list of all domains used by the cookies.
cookies | Public method to get the cookies of the cookie jar.
filterTrackingCookies | Public method to get the filter tracking cookies flag.
keepPolicy | Public method to get the keep policy.
removeCookie | Public method to remove a cookie.
removeCookies | Public method to remove a list of cookies.
setAcceptPolicy | Public method to set the accept policy.
setAllowForSessionCookies | Public method to set the list of allowed session cookie domains.
setAllowedCookies | Public method to set the list of allowed domains.
setBlockedCookies | Public method to set the list of blocked domains.
setFilterTrackingCookies | Public method to set the filter tracking cookies flag.
setKeepPolicy | Public method to set the keep policy.

### Static Methods

None

#### CookieJar (Constructor)

CookieJar(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### CookieJar.__cookieAdded

__cookieAdded(cookie)

Private slot handling the addition of a cookie.

cookie (QNetworkCookie)
  cookie which was added

#### CookieJar.__cookieFilter

__cookieFilter(request)

Private method to filter cookies.

request (QWebEngineCookieStore.FilterRequest)
  reference to the cookie filter request object

Return:
  flag indicating cookie access is allowed

Return Type:
  bool

#### CookieJar.__cookieRemoved

__cookieRemoved(cookie)

Private slot handling the removal of a cookie.

cookie (QNetworkCookie)
  cookie which was removed

#### CookieJar.__isOnDomainList

__isOnDomainList(rules, domain)

Private method to check, if either the rule matches the domain exactly or the domain ends with ".rule".

rules (list of str)
  list of rules
domain (str)
  domain name to check

Return:
  flag indicating a match

Return Type:
  bool

#### CookieJar.__load

__load()

Private method to load the cookies settings.

#### CookieJar.__matchDomain

__matchDomain(cookieDomain, siteDomain)

Private method to check, if a URLs host matches a cookie domain according to RFC 6265.

cookieDomain (str)
  domain of the cookie
siteDomain (str)
  domain or host of an URL

Return:
  flag indicating a match

Return Type:
  bool

#### CookieJar.__rejectCookie

__rejectCookie(cookie, cookieDomain)

Private method to test, if a cookie shall be rejected.

cookie (QNetworkCookie)
  cookie to be tested
cookieDomain (str)
  domain of the cookie

Return:
  flag indicating the cookie shall be rejected

Return Type:
  bool

#### CookieJar.__save

__save()

Private method to save the cookies settings.

#### CookieJar.acceptPolicy

acceptPolicy()

Public method to get the accept policy.

Return:
  current accept policy

Return Type:
  int

#### CookieJar.allowForSessionCookies

allowForSessionCookies()

Public method to return the list of allowed session cookie domains.

Return:
  list of allowed session cookie domains

Return Type:
  list of str

#### CookieJar.allowedCookies

allowedCookies()

Public method to return the list of allowed domains.

Return:
  list of allowed domains

Return Type:
  list of str

#### CookieJar.blockedCookies

blockedCookies()

Public method to return the list of blocked domains.

Return:
  list of blocked domains

Return Type:
  list of str

#### CookieJar.clear

clear()

Public method to clear all cookies.

#### CookieJar.close

close()

Public slot to close the cookie jar.

#### CookieJar.cookieDomains

cookieDomains()

Public method to get a list of all domains used by the cookies.

Return:
  list of domain names

Return Type:
  list of str

#### CookieJar.cookies

cookies()

Public method to get the cookies of the cookie jar.

Return:
  list of all cookies

Return Type:
  list of QNetworkCookie

#### CookieJar.filterTrackingCookies

filterTrackingCookies()

Public method to get the filter tracking cookies flag.

Return:
  filter tracking cookies flag

Return Type:
  bool

#### CookieJar.keepPolicy

keepPolicy()

Public method to get the keep policy.

Return:
  keep policy

Return Type:
  int

#### CookieJar.removeCookie

removeCookie(cookie)

Public method to remove a cookie.

cookie (QNetworkCookie)
  cookie to be removed

#### CookieJar.removeCookies

removeCookies(cookies)

Public method to remove a list of cookies.

cookies (list of QNetworkCookie)
  list of cookies to be removed

#### CookieJar.setAcceptPolicy

setAcceptPolicy(policy)

Public method to set the accept policy.

policy (int)
  accept policy to be set

#### CookieJar.setAllowForSessionCookies

setAllowForSessionCookies(list_)

Public method to set the list of allowed session cookie domains.

list_ (list of str)
  list of allowed session cookie domains

#### CookieJar.setAllowedCookies

setAllowedCookies(list_)

Public method to set the list of allowed domains.

list_ (list of str)
  list of allowed domains

#### CookieJar.setBlockedCookies

setBlockedCookies(list_)

Public method to set the list of blocked domains.

list_ (list of str)
  list of blocked domains

#### CookieJar.setFilterTrackingCookies

setFilterTrackingCookies(filterTrackingCookies)

Public method to set the filter tracking cookies flag.

filterTrackingCookies (bool)
  filter tracking cookies flag

#### CookieJar.setKeepPolicy

setKeepPolicy(policy)

Public method to set the keep policy.

policy (CookieKeepPolicy)
  keep policy to be set

Up

## CookieKeepPolicy

Class defining the cookie keep policies.

### Derived from

enum.Enum

### Class Attributes

UntilExit
UntilExpire

### Class Methods

None

### Methods

None

### Static Methods

None

Up